import * as actionType from './constant'
import {Map} from 'immutable'
const defaultState = Map({
  topList :[], 
  currentIndex : 0,
  playlistDetail:{}
})

function reducer(state = defaultState , action){
  switch(action.type){
    case actionType.CHANGE_TOP_LIST:
      return state.set("topList",action.topList);
    case actionType.CHANGE_CURRENT_INDEX:
        return state.set("currentIndex",action.index);
    case actionType.CHANGE_DETAIL_LIST:
        return state.set("playlistDetail",action.playlistDetail)
    default:
      return state;
  }
}

export default reducer;